package com.subnext.model;

import java.util.Date;

import com.google.appengine.api.datastore.Entity;

import static com.subnext.utils.EntityUtil.getIntegerProperty;
import static com.subnext.utils.EntityUtil.getLongProperty;
import static com.subnext.utils.EntityUtil.setProperty;
public class TagCrossRefEntity extends BaseEntity{
	
	private static final long serialVersionUID = 1L;
	public static final int CONTENT = 1;
	public static final int PICTURE = 2;
	
	private Long entityId;
		
	private int entityType;

	/**
	 * @param tagId
	 * @param entityId
	 * @param entityType
	 * @param createDate
	 * @param status
	 */
	public TagCrossRefEntity(Long tagId, Long entityId, int entityType,
			Date createDate, int status) {
		super();
		this.entityId = entityId;
		this.entityType = entityType;
	}


	@Override
	public void save(Entity entity) {
		super.save(entity);
		setProperty(entity, "entityId", entityId, true);
		setProperty(entity, "entityType", entityType, true);
	}


	@Override
	public void load(Entity entity) {
		super.load(entity);
		entityId = getLongProperty(entity, "entityId");
		entityType = getIntegerProperty(entity, "entityType", CONTENT);
	}


	public Long getEntityId() {
		return entityId;
	}

	public void setEntityId(Long entityId) {
		this.entityId = entityId;
	}

	public int getEntityType() {
		return entityType;
	}

	public void setEntityType(int entityType) {
		this.entityType = entityType;
	}

}
